package com.sixth.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sixth.dao.ArticleDao;
import com.sixth.entity.Article;
import com.sixth.entity.Banner;
import com.sixth.entity.BottomArticle;
import com.sixth.entity.TableResult;
import com.sixth.service.ArticleService;
import com.sixth.until.CommonResult;
import org.checkerframework.common.subtyping.qual.Bottom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @program: self-tui-education
 * @description:
 * @author: C
 * @create: 2022-04-23 17:01
 **/
@Service
public class ArticelServicelmpl implements ArticleService {
    @Autowired
    private HttpSession session;
    @Autowired
    private ArticleDao articleDao;

    @Override
    public TableResult getArticleByNavId(String navId) {
        BottomArticle bottomArticle= (BottomArticle) session.getAttribute("bottomArticle");

        Article article1 = articleDao.selectByNavIdArticle(navId);
        return new TableResult(2000,"查询成功",12,article1);
    }

    @Override
    public CommonResult updateArticleByNavId(Article article) {
        String navId = article.getNavId();
        String artTitle = article.getArtTitle();
        String artDesc = article.getArtDesc();
        articleDao.UpdateArticle(navId,artTitle,artDesc);
        return new CommonResult(2000,"修改成功",null);
    }

}
